/*
 * @Author: your name
 * @Date: 2021-02-27 23:28:17
 * @LastEditTime: 2021-07-22 17:17:30
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue3-antd-koa\vue3-antd-pc\vue.config.js
 */
const hardPlugin = require("hard-source-webpack-plugin")
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const { resolve } = require("path")
const resolveDir = (dir) => {
	return resolve(__dirname, dir)
}
module.exports = {
	publicPath: "./",
	devServer: {
		proxy: {
			"/api": {
				target: "http://localhost:3000",
				changeOrigin: true
			}
		}
	},
	productionSourceMap: false,
	lintOnSave: false,
	configureWebpack: {
		plugins: [
			new hardPlugin({
				cacheDirectory: resolveDir("cache")
			}),
			// new BundleAnalyzerPlugin(),
		],
		resolve: {
			alias: {
				"@c": resolveDir("src/components"),
				"@a": resolveDir("src/assets"),
				"@u": resolveDir("src/use"),
				"@r": resolveDir("src/router"),
				"@v": resolveDir("src/views"),
				"@p": resolveDir("src/plugins"),
				"@vp": resolveDir("src/view-provider"),
				"@b": resolveDir("src/blocks")
			}
		},
		externals: {
			moment: 'moment'
		}
	}
}
